package com.example.rmi;

import java.io.Serializable;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
 * TODO: 这里要写注释的!
 */
public class HelloImpl extends UnicastRemoteObject implements IService {

    public HelloImpl() throws RemoteException  {
    }

    @Override public String sayHello() {
        return "hello bruce.";
    }

    @Override public String sayHello(String name) {
        return name;
    }

    @Override public User getUser() throws RemoteException {
        return new User("胡广鑫",30);
    }

    public static class User implements Serializable{
        public String name;
        public int age;

        public User(String name, int i) {
            this.name= name;
            this.age= i;
        }
        public String toString(){
            return this.name+":"+this.age;
        }
    }
}
